scores = [23,1233,1,23,4,23,4,23,42,23] #列表
'''
列表：容器
下表，长度，切片
len()
循环：
    直接遍历
    下标遍历
常用操作
    添加元素
        append:列表末尾添加一个元素
        insert:指定下标添加一个元素
        extend:合并列表
    删除元素：
        remove
        pop 
        clear
        del
    修改元素：
        指定下标进行赋值
    查询：
        in 
        index
        count
        
'''
print(scores[2])
print(len(scores))
print(scores[0:5])
print(scores[:5])
print(scores[-3:])
print(scores[::2])
print(len(scores))

sumScore = 0
for score in scores:
    print(score)
    sumScore += score
print(sumScore)

for i in range(0,len(scores)):
    print(i,scores[i])

scores.append(100)
print(scores)

scores.insert(2,222)
print(scores)

alist = ["a","b","c"]
blist = ["aa","bb","cc"]

alist.extend(blist)
print(alist)

scores.remove(4)
print(scores)
s = scores.pop(0)
print(scores)
print(s)

del scores[0]
print(scores)

# scores.clear()
# print(scores)

scores[3] = 88
print(scores)

if 231 in scores:
    print("23存在")

print(scores.index(23))
print(scores.count(23))

# 排序
scores.sort(reverse=True)
print(scores)
scores.reverse()
print(scores)

allNames = [["12","12","12","2"],["12","12","12"],["12","12","12"]]
i = 1
for c in allNames:
    print("{}班{}人".format(i,len(c)))
    for s in c:
        print(s)
    i += 1

# print(scores[0])
# print(scores[-1])
    
min = scores[0]
max = scores[0]
for s in scores:
    if s > max:
        max = s
    if s < min:
        min = s
print(max,min)

tuple=("abc","bcd","efg")
print(tuple[0]) #abc
print(tuple[::-1]) #abc bcd efg